using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using StupidSpaceThing;

namespace RacerGame
{
	internal class TradePortal : Structure
	{

		public static List<TradePortal> Portals = new List<TradePortal>();

		private int credits;
		private int maxCredits;
		private int creditRate;
		public int Credits { get { return credits; } }		

		public TradePortal(Vector3 position, float rotation, int maxCredits, int creditRate)
			: base(new TradePortalEntity(position)) {
			entity.Rotate(0, rotation, 0);
			this.maxCredits = maxCredits;
			this.creditRate = creditRate;
			credits = maxCredits / 2;
			Portals.Add(this);
		}

		public override void Update(RealGameTime gameTime) {
			credits += creditRate;
			if( credits > maxCredits ) {
				credits = maxCredits;
			}
			base.Update(gameTime);
		}
	}
}
